Class Part

Summary

Fully Qualified Name: Laminas\Mail\Storage\Part
Implements: RecursiveIterator, PartInterface

Description

Methods

Name Description Defined By
__construct() Public constructor Part
__get() Getter for mail headers - name is matched in lowercase Part
__isset() Isset magic method proxy to hasHeader Part
__toString() magic method to get content of part Part
countParts() Count parts of a multipart part Part
current() implements Iterator::current() Part
getChildren() implements RecursiveIterator::getChildren() Part
getContent() Body of part Part
getHeader() Get a header in specified format Part
getHeaderField() Get a specific field from a header like content type or all fields as array Part
getHeaders() Access headers collection Part
getPart() Get part of multipart message Part
getSize() Return size of part Part
hasChildren() implements RecursiveIterator::hasChildren() Part
isMultipart() Check if part is a multipart message Part
key() implements Iterator::key() Part
next() implements Iterator::next() Part
rewind() implements Iterator::rewind() Part
valid() implements Iterator::valid() Part

Method Details

__construct()

Public constructor

Part supports different sources for content. The possible params are:

Parameter Name Type Description
$params array full

Returns:

__get()

Getter for mail headers - name is matched in lowercase

This getter is short for Part::getHeader($name, 'string')

Parameter Name Type Description
$name string header

Returns: string value of header

__isset()

Isset magic method proxy to hasHeader

This method is short syntax for Part::hasHeader($name);

Parameter Name Type Description
$ string
$name

Returns: bool

__toString()

magic method to get content of part

Returns: string content

countParts()

Count parts of a multipart part

Returns: int number of sub-parts

current()

implements Iterator::current()

Returns: \Part current part

getChildren()

implements RecursiveIterator::getChildren()

Returns: \Part same as self::current()

getContent()

Body of part

If part is multipart the raw content of this part with all sub parts is returned

Returns: string body

getHeader()

Get a header in specified format

Internally headers that occur more than once are saved as array, all other as string. If $format is set to string implode is used to concat the values (with Mime::LINEEND as delim).

Parameter Name Type Description
$name string name
$format string change

Returns: string|array|\HeaderInterface|\ArrayIterator value of header in wanted or internal format

getHeaderField()

Get a specific field from a header like content type or all fields as array

If the header occurs more than once, only the value from the first header is returned.

Throws an Exception if the requested header does not exist. If the specific header field does not exist, returns null.

Parameter Name Type Description
$name string name
$wantedPart string the
$firstName string key

Returns: string|array wanted part or all parts as array($firstName => firstPart, partname => value)

getHeaders()

Access headers collection

Lazy-loads if not already attached.

Returns: \Headers

getPart()

Get part of multipart message

Parameter Name Type Description
$num int number

Returns: \Part wanted part

getSize()

Return size of part

Quite simple implemented currently (not decoding). Handle with care.

Returns: int size

hasChildren()

implements RecursiveIterator::hasChildren()

Returns: bool current element has children/is multipart

isMultipart()

Check if part is a multipart message

Returns: bool if part is multipart

key()

implements Iterator::key()

Returns: string key/number of current part

next()

implements Iterator::next()

Returns:

rewind()

implements Iterator::rewind()

Returns:

valid()

implements Iterator::valid()

Returns: bool check if there's a current element

Top